package com.xjtu.chapter09;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/9/4 22:13
 */
public class CollectionsTest {
    public static void main(String[] args) {
        //排序
        List<Double> list = new ArrayList<Double>();
        double array[]={123,243,141.1,23,45};
        for (int i = 0; i < array.length; i++) {
            list.add(new Double(array[i]));
        }
        Collections.sort(list);
        System.out.println("sorted number: ");
        for (int i = 0; i <array.length ; i++) {
            System.out.println(list.get(i));
        }
        //逆转
        Collections.reverse(list);
        System.out.println("reversed number: ");
        for (int i = 0; i <array.length ; i++) {
            System.out.println(list.get(i));
        }
        System.out.println("min number is: "+Collections.min(list));
    }
}
